package com.gexin.common.utils;

import java.util.Random;

public class RandomUtil {

	public static String getSixRandom() {
		 int[] array = {0,1,2,3,4,5,6,7,8,9};
		 Random rand = new Random();
		 for (int i = 10; i > 1; i--) {
		     int index = rand.nextInt(i);
		     int tmp = array[index];
		     array[index] = array[i - 1];
		     array[i - 1] = tmp;
		 }
		 int result = 0;
		 for(int i = 0; i < 6; i++)
		     result = result * 10 + array[i];
		 int len=String.valueOf(result).length();
		 if (len==6) {
			return String.valueOf(result);
		}else{
			StringBuilder builder=new StringBuilder(result);
			for (int i = 0; i < 6-len; i++) {
				builder.append("0");
			}
			return builder.toString();
		}
		
	}
	
	
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
